<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

	<script src = "../js/jquery-1.12.1.js" type = "text/javascript"></script>
	<script src = "../js/common.js" type = "text/javascript"></script>
	
	<link href="<%=request.getContextPath() %>/css/extremecomponents.css" rel="stylesheet" type="text/css" />
	<link href="<%=request.getContextPath() %>/css/global.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/style.css" />
<title>作业难度整体分析</title>
</head>
<script type="text/javascript">

	//作业框回显
	$(function() {
	$("select[name='jobId']")
	.val(
	'<c:out value="${CONDITIONMAP.jobId}" />');
	});

	$(function() {
	$("#lookfor").click(
        function() {
            formPost(window.SearchState, '','jobhard?ActionType=job_Hard_Overall', this);
            //formPost(window.SearchState, '','authuser?ActionType=authuser_AddInit&FLAG=add', this);
        });
	});
	
</script>
<body>
<div id="current">当前位置：题目难易度分析 &gt; 整体分析</div>
<div class="page-container">
    <form id="SearchState" method="post">
	<div class="text-c"> 
		作业:
		<span class="select-box inline">
			<select class="select"  name="jobId" id="jobId">
				<option value="" selected="selected">本次作业</option>
				<c:forEach items="${ALLJOB }"  var="everyJob">
				<option value="${everyJob.job_id }">${everyJob.job_id }</option>
				</c:forEach>
			</select>
		</span>
		<input type="hidden" id="" name="">
		<button id="lookfor" type="button" class="btn btn-primary radius">查询</button>
	</div>
	</form>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<!-- <th width="25"><input type="checkbox" name="" value=""></th> -->
					<th width="105">题号</th>
					<th width="105">题目名</th>
					<th width="105">提交</th>
					<th width="105">平均分</th>
					<th width="105">满分</th>
					<th width="105">零分</th>
				</tr>
			</thead>
			<tbody>
					 <c:forEach items="${JOBHARDSTATUS}"  var="currentJob">
					 <tr class="text-c">
	                               <td class="topic_id">${currentJob.topic_id}  </td>
	                               <td class="topic_name">${currentJob.topic_name }</td>
	                              <td class="submit_status"><span  onClick="actually(this)">${currentJob.actually_counts}</span> /  
	                              													<span  onClick="should(this)">${currentJob.should_counts}</span> </td>
	                               <td class="avg"><fmt:formatNumber type="number" value="${currentJob.avgScorer}" pattern="0.00" /></td>
	                               <td class="good_job"><span  onClick="goodJob(this)">${currentJob.goodJob}</span>
	                                										 / ${currentJob.should_counts}</td>
	                               <td class="bad_job"><span  onClick="badJob(this)">${currentJob.badJob}</span>
	                               										    /  ${currentJob.should_counts}</td>
	                   </tr>
	                  </c:forEach>
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript">
	//应交人数点击事件
	function should(e){
		var shouldCount=$(e).text();
		var jobId=$("#jobId").val();
		$.ajax({
	       type : "post",
	       dataType: "json",
	       url : "jobhard?ActionType=job_Hard_Overall_Should",
	       data :  {"JOB_ID":jobId},
	       success : function(message) {
	    	   var nameList=new Array();
	    	   $.each(message, function(i,student) {
	    		   nameList.push(student.student_name);
       			});
	           	confirm("应交作业学生名单为：\n"+nameList); 
	           	//在页面上弹出确认对话框
	       }
	   });
	}; 
	//实交人数点击事件
	function actually(e){
		var actualCount=$(e).text();
		var topicId = $(e).parent().parent().find(".topic_id").text(); 
		var jobId=$("#jobId").val();
		$.ajax({
	       type : "post",
	       dataType: "json",
	       url : "jobhard?ActionType=job_Hard_Overall_Actual",
	       data : {"JOB_ID":jobId,"TOPIC_ID":topicId},
	       success : function(message) {
	    	   var nameList=new Array();
	    	   $.each(message, function(i,student) {
	    		   nameList.push(student.student_name);
       			});
	           	confirm("实交作业学生名单为：\n"+nameList); 
	           	//在页面上弹出确认对话框
	       }
		}); 
	};
	
	//满分点击事件
	function goodJob(e){
		var goodCount=$(e).text();
		var topicId = $(e).parent().parent().find(".topic_id").text(); 
		var jobId=$("#jobId").val();
		if(goodCount==0){
			alert("本题没有满分的学生");
		}else{
			$.ajax({
			       type : "post",
			       dataType: "json",
			       url : "jobhard?ActionType=job_Hard_Overall_Good_Job",
			       data : {"JOB_ID":jobId,"TOPIC_ID":topicId},
			       success : function(message) {
			    	   var nameList=new Array();
			    	   $.each(message, function(i,student) {
			    		   nameList.push(student.student_name);
		       			});
			           	confirm("满分学生名单为：\n"+nameList); 
			           	//在页面上弹出确认对话框
			       }
				}); 
		}
	};
	
	//0分人数点击事件
	function badJob(e){
		var badCount=$(e).text();
		var topicId = $(e).parent().parent().find(".topic_id").text(); 
		var jobId=$("#jobId").val();
		if(badCount==0){
			alert("本题没有零分的学生");
		}else{
			$.ajax({
		       type : "post",
		       dataType: "json",
		       url : "jobhard?ActionType=job_Hard_Overall_Bad_Job",
		       data : {"JOB_ID":jobId,"TOPIC_ID":topicId},
		       success : function(message) {
		    	   var nameList=new Array();
		    	   $.each(message, function(i,student) {
		    		   nameList.push(student.student_name);
	       			});
		           	confirm("零分作业学生名单为：\n"+nameList); 
		           	//在页面上弹出确认对话框
		       }
			}); 
		}
	}



</script>
</body>
</html>